package com.coocaa.ops.api.base.third.dmp.feign;

import com.coocaa.ops.api.base.third.FeignServiceNameConstants;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import java.net.URI;
import java.util.Map;

/**
 * @author tangminghong
 * @date 2020-09-04
 */
@Slf4j
@Component
public class DmpFeignFallbackFactory  implements FallbackFactory<DmpFeignClient> {


    @Override
    public DmpFeignClient create(Throwable cause) {
        return (URI uri, final Map<String, String> headers,  Map<String, String> data) -> {
            log.error(FeignServiceNameConstants.DMP_SERVICE + " 出现问题: " + cause.toString() + ", 进行熔断处理!");
            return "";
        };
    }
}
